package com.xianniu.ltc.enums;

import lombok.Getter;

/**
 * @author wangruijie
 * @version 1.0
 * @description: < 重要程度 >
 * @date 2021/5/27 19:32
 */
@Getter
public enum LeadSourceEnum {
    QYWZ("企业微站","019-0177f6e5b4870042"),
    QYGW("企业官网","019-017801c027b40009"),
    ZH("展会","019-017801c05a30000a"),
    MP("名片","019-017801c06dc3000b"),
    HYYX("会议营销","019-017801c08652000c"),
    BD("百度","019-017801c0bb3f000d"),
    QT("其他","019-017801c229b1000e");

    private String key;
    private String value;

    LeadSourceEnum(String key, String value){
        this.key=key;
        this.value=value;
    }
    /**
     * 自己定义一个静态方法,通过key返回枚举常量对象
     * @param key
     * @return
     */
    public static LeadSourceEnum getByKey(String key){

        for (LeadSourceEnum color: values()) {
            if(color.getKey().equals(key)){
                return  color;
            }
        }
        return null;
    }

    /**
     * 自己定义一个静态方法,通过value返回枚举常量对象
     * @param value
     * @return
     */
    public static LeadSourceEnum getByValue(String value){

        for (LeadSourceEnum color: values()) {
            if(color.getValue().equals(value)){
                return color;
            }
        }
        return null;
    }
}
